package cn.itcast.myapplication.lifecycle;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.PersistableBundle;

import cn.itcast.myapplication.R;

public class MyLifeCycles extends AppCompatActivity {

    MyChronometer myChronometer;//计时器

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_life_cycles);

        myChronometer=findViewById(R.id.meter);//初始化
        getLifecycle().addObserver(myChronometer);//添加观察者，就可以让组件感知生命周期，Activity进一步解耦



    }


}